package five.philosophers;


import five.philosophers.Fork;
import java.util.ArrayList;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author mateusz.ledzewicz
 */
public class IdMemory {
    private static int forkId = 0;
    private static int philosopherId = 0;
    
    private static ArrayList<Fork> forks = new ArrayList<Fork>();
    private static ArrayList<Philosopher> philosophers= new ArrayList<Philosopher>();
    
    private static int getNewForkId(){
        return forkId++;
    }
    
    public static int getNewPhilosopherId(){
        return philosopherId++;
    }
    
    public static void createFork(){
        Fork fork = new Fork(getNewForkId());
        //fork.start();
        forks.add(fork);
    }
    
    
    public static void createPhilosopher(){
        Philosopher philosopher = new Philosopher();
        philosopher.start();
        philosophers.add(philosopher);
    }
    
    
    public static Fork getFork(int id){
        return forks.get(id);
    }
    
    public static ArrayList<Philosopher> getPhilosophers(){
        return philosophers;
    }
    
    
}
